package jnpf.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jnpf.entity.MpEventContentEntity;
import jnpf.mapper.MpEventContentMapper;
import jnpf.service.MpEventContentService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 事件内容
 *
 * @author 南通渡课开发平台组
 * @version V3.1.0
 * @copyright 南通渡课信息技术有限公司
 * @date 2019年9月27日 上午9:18
 */
@Service
public class MpEventContentServiceImpl extends ServiceImpl<MpEventContentMapper, MpEventContentEntity> implements MpEventContentService {

    @Override
    public MpEventContentEntity getInfo(String id) {
        QueryWrapper<MpEventContentEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(MpEventContentEntity::getEventKey, id);
        return this.getOne(queryWrapper);
    }

    @Override
    @Transactional
    public boolean delete(MpEventContentEntity entity) {
       return this.removeById(entity.getEventKey());
    }

    @Override
    public void create(MpEventContentEntity entity) {
        this.save(entity);
    }

    @Override
    public boolean update(MpEventContentEntity entity) {
        return  this.updateById(entity);
    }
}
